package com.yitiao.designmodel.struct.proxy.dynamic.jdk;


import java.lang.reflect.Proxy;

public class JdkProxy {
    public static <T> Object getProxy(T t) {
        return Proxy.newProxyInstance(t.getClass().getClassLoader(),
                t.getClass().getInterfaces(),
                (proxy, method, args) -> {
                    System.out.println("代理");
                    return method.invoke(t, args);
                });
    }
}
